<script type="text/javascript">
function send(flag){
	$("#to").val("");
	$("#recever .address_list span").each(function() {
		$("#to").val($("#to").val() + $(this).find("b").text() + '|' + $(this).attr("email") + ";")
	})
	$("#cc").val("");
	$("#carbon_copy .address_list span").each(function() {
		$("#cc").val($("#cc").val() + $(this).find("b").text() + '|' + $(this).attr("email") + ";")
	})

	$("#bcc").val("");
	$("#blind_carbon_copy .address_list span").each(function() {
		$("#cc").val($("#cc").val() + $(this).find("b").text() + '|' + $(this).attr("email") + ";")
	})
	if ($("#to").val().indexOf("@") < 1) {
		alert("请选择收件人");
		$("#recever letter").focus();
		return
	}
	editor.sync();
	if(check_form("form_send")){
		if (flag) {
			sendForm("form_send", "{:U('send')}");
		} else {
			sendForm("form_send", "{:U('save_darft')}");
		}
	}
}

	function toggle_bcc(){
		if ($("#bcc").attr("class").indexOf("display-none") < 0){
			$("#bcc").addClass("display-none");
			$("#toggle_bcc_icon").addClass("icon-chevron-down");
			$("#toggle_bcc_icon").removeClass("icon-chevron-up");
		} else {
			$("#bcc").removeClass("display-none");
			$("#toggle_bcc_icon").addClass("icon-chevron-up");
			$("#toggle_bcc_icon").removeClass("icon-chevron-down");
		}
	}

function popup_contact(){
winopen("{:U("popup/contact")}",730,574);
}
</script>
